package A13_四大函数式接口;

import java.util.function.Function;

/**
 * @Author: KingWang
 * @Date: 2021/5/25
 * @Desc:
 **/
public class FunctionDemo {
    public static void main(String[] args) {

        Function<Integer,Integer> function = new Function<Integer, Integer>() {
            @Override
            public Integer apply(Integer s) {
                return s*2;
            }
        };

        Function<Integer,Integer> function1 =  s -> {return s * 2;};


        System.out.println(function.apply(2));
        System.out.println(function1.apply(2));
    }

}
